// edge管理表
import { axios } from '@/utils/request';

/**
 * 保存
 * @params data
 * {
    {"description":{"description":"描述","type":"string"}},
    {"heartbeatUrl":{"description":"心跳链接","type":"string"}},
    {"name":{"description":"名称","type":"string"}},
    {"number":{"description":"编号","type":"string"}},
    {"password":{"description":"密码","type":"string"}},
    {"userName":{"description":"用户名","type":"string"}}
   }
 */
export function postEdgemanagement(data) {
  return axios({
    method: 'post',
    url: 'edgemanagement',
    data
  })
}

/**
 * 修改
 * @params data
 * {
    {"description":{"description":"描述","type":"string"}},
    {"heartbeatUrl":{"description":"心跳链接","type":"string"}},
    {"id":{"description":"$column.comments","type":"integer"}},
    {"name":{"description":"名称","type":"string"}},
    {"number":{"description":"编号","type":"string"}},
    {"password":{"description":"密码","type":"string"}},
    {"userName":{"description":"用户名","type":"string"}}
   }
 */
export function putEdgemanagement(data) {
  return axios({
    method: 'put',
    url: 'edgemanagement',
    data
  })
}

/**
 * 删除
 * @params params
 * {
    {"ids":{"required":false,"type":"string"}}
   }
 */
export function deleteEdgemanagement(params) {
  return axios({
    method: 'delete',
    url: 'edgemanagement',
    params
  })
}

/**
 * 获取edge-token
 * @params params
 * {
    {"id":{"required":true,"type":"integer"}}
   }
 */
export function getEdgemanagementEdgeToken(params) {
  return axios({
    method: 'get',
    url: 'edgemanagement/edge/token',
    params
  })
}

/**
 * 详情
 * @params params
 * {
    {"id":{"required":true,"type":"integer"}}
   }
 */
export function getEdgemanagementInfo(params) {
  return axios({
    method: 'get',
    url: 'edgemanagement/info',
    params
  })
}

/**
 * 列表
 * @params params
 * 
 */
export function getEdgemanagementList(params) {
  return axios({
    method: 'get',
    url: 'edgemanagement/list',
    params
  })
}

/**
 * 分页列表
 * @params params
 * {
    {"pageNo":{"required":false,"type":"integer","default":1}},
    {"pageSize":{"required":false,"type":"integer","default":20}},
    {"name":{"required":false,"type":"string"}},
    {"state":{"required":false,"type":"integer"}}
   }
 */
export function getEdgemanagementPageList(params) {
  return axios({
    method: 'get',
    url: 'edgemanagement/page/list',
    params
  })
}

/**
 * 重名校验
 * @params params
 * {
    {"id":{"required":false,"type":"integer"}},
    {"field":{"required":false,"type":"string"}},
    {"value":{"required":false,"type":"object"}}
   }
 */
export function getEdgemanagementVerification(params) {
  return axios({
    method: 'get',
    url: 'edgemanagement/verification',
    headers: { validate: true },
    params
  })
}